package com.rocket.controller;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TalkController {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;
    @GetMapping("/start")
    public String startTalk(){
        String txt="你好啊";
        Message<String> message = MessageBuilder.withPayload(txt).build();
        rocketMQTemplate.syncSend("topicA",message);
        return "已开始对话";
    }
}
